<template>
  <div style="height: 100vh;  margin-top: 50px;width: 1200px;margin: 0 auto;">
    <div class="pd-10" style="text-align: center;">
      <h1>上传视频预览区</h1>
    </div>
    <el-card style="padding: 10px 0; margin-bottom: 20px; margin-top: 50px; " v-for="item in video" :key="item.id">
      <div style=" padding: 10px 0;border-bottom: 1px dashed #cccccc">
        <span style="font-size: 18px; cursor: pointer" class="item" @click="detail(item)">{{ item.name }}</span>
        <span style="font-size: 12px; float: right; cursor: pointer; margin-top: 10px"
              class="item">文件大小为：{{ item.size }} kb</span>
      </div>

    </el-card>

    <el-card>
      <input v-model="message" @keyup.enter="sendMessage" />
      <div v-for="(msg, index) in messages" :key="index">
        {{ msg }}
      </div>

    </el-card>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: "Video",
  data() {
    return {
      video: [],
      message: '',
      messages: [],
    }
  },
  mounted() {
    this.request.get("/files/front/all").then(res => {
      if (res.code === "200") {
        this.video = res.data.filter(v => v.type === "mp4")
      }
    })
  },
  methods: {
    detail(item) {
      this.$router.push({
        path: "/front/videoDetail",
        query: {
          url: item.url
        }
      })
    },
   
  }
}
</script>

<style scoped>
.item:hover {
  color: #3a8ee6;
}
</style>